前言
搭建环境
- jdk 1.8.0_161
- elasticsearch-5.6.8
- 同一网段的三台虚拟机:192.168.1.111, 192.168.1.112, 192.168.1.113
节点划分
由于只有三台虚拟机,所以没有必要将节点职责划分太细,每个节点都完全具备以下能力;不调整es节点的属性默认配置即可。
192.168.1.111:Master-eligible node,Data node,Client node,Ingest node |
使用默认配置:node.master: true
node.data: true
node.ingest: true
search.remote.connect: true
集群配置
统一集群的名称:
cluster.name: lpp-elasticsearch-cluster |
192.168.1.111
cluster.name: lpp-elasticsearch-cluster |
192.168.1.112
cluster.name: lpp-elasticsearch-cluster |
192.168.1.113
cluster.name: lpp-elasticsearch-cluster |
集群状态
http://192.168.1.111:9200/_cluster/health?pretty
{ |
status | 含义 |
---|---|
green | 所有的主分片和副本分片都正常运行 |
yellow | 所有的主分片都正常运行,但不是所有的副本分片都正常运行 |
red | 有主分片没能正常运行 |
遇到的问题
节点间无法通信
[2018-04-18T03:43:49,714][INFO ][o.e.d.z.ZenDiscovery ] [node-2] failed to send join request to master [{node-1}{XCSxTQC0QquDZAMR9OdGww}{Nr10AA1vS0ydVQ51scSXnw}{192.168.1.111}{192.168.1.111:9300}], reason [RemoteTransportException[[node-1][192.168.1.111:9300][internal:discovery/zen/join]]; nested: ConnectTransportException[[node-2][192.168.1.112:9300] connect_timeout[30s]]; nested: IOException[No route to host: 192.168.1.112/192.168.1.112:9300]; nested: IOException[No route to host]; ] |
防火墙未关闭的原因导致的,在centos7下关闭防火墙并重启机器即可。生产环境为了安全性,配置防火墙只对9300,9200等通信端口支持访问即可。
# 1.停止firewall |
参考链接